package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.BaseOrder;
import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;

/**
 * @author cici
 */
@Slf4j
public abstract class BaseOrderService <M extends BaseMapper<T>,T extends BaseOrder> extends ServiceImpl<M,T> {

    public void commonLogic(){
        log.info("do common logic.");
    }

    public BigDecimal calculateTotalMoney(T order){
        BigDecimal totalMoney = BigDecimal.ZERO;
        totalMoney = order.getPrice().multiply(BigDecimal.valueOf(order.getNum()));
        return totalMoney;
    }
}
